package com.cssw.fyzb.busi.api.live;

import com.cssw.fyzb.busi.service.live.LiveService;
import com.ydn.appserver.Action;
import com.ydn.appserver.Request;
import com.ydn.appserver.Response;
import com.ydn.appserver.annotations.Function;
import com.ydn.appserver.annotations.Parameter;
import com.ydn.appserver.annotations.Type;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 获取直播统计信息
 *
 * @author YangYiQun
 */
@Function(description = "获取直播统计", parameters = {
        @Parameter(name = "liveId", type = Type.String, description = "直播标识", required = true),
        @Parameter(name = "userId", type = Type.String, description = "用户标识", required = true)
})
@Component
public class GetLiveStat implements Action {

    private static final Logger logger = LoggerFactory.getLogger(GetLiveStat.class);

    @Autowired
    LiveService liveService;

    @Override
    public Response execute(Request request) throws Exception {
        Long userId = request.getLong("userId");
        Long liveId = request.getLong("liveId");

        return Response.success().put("data", liveService.getLiveStat(liveId, userId));
    }
}
